package com.yanqu.road.server.cmd.monopolymarket.fortress;

import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.monopolymarket.MonopolyMarketProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.monopolymarket.MonopolyMarketFortressMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @Description
 * @Author cwq
 * @Data 2021/10/15 16:32
 */
@Cmd(code = CrossProtocol.C_MONOPOLY_MARKET_FORTRESS_GET_UNION_DISPATCH_DETAIL, desc = "边关要塞 获取联盟派遣信息")
public class CrossMonopolyMarketFortressGetUnionDispatchDetailCmd extends CrossCommand {

    private long userId ;
    private String unionId ;
    private int cityId ;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MonopolyMarketProto.MonopolyMarketFortressGetUnionDispatchDetailReqMsg req = MonopolyMarketProto.MonopolyMarketFortressGetUnionDispatchDetailReqMsg.parseFrom(packet.getBytes());
        userId = packet.getPlayerId();
        unionId = req.getUnionId();
        cityId = req.getCityId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId , YanQuMessageUtils.buildMessage(ClientProtocol.U_MONOPOLY_MARKET_FORTRESS_GET_UNION_DISPATCH_DETAIL, MonopolyMarketFortressMgr.getUnionDispatchDetail(serverId,userId,unionId,cityId)));
    }

    @Override
    public void sendData() {

    }
}
